#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Probability.h>
#include <math.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Probility)
{
	TEST(should be able to calc the Probability that A&B happen: 0.7*0.8 = 0.56)
	{
		Probability probabilityA(0.7);
		
		Probability probabilityB(0.8);
                
		if((fabs((probabilityA & probabilityB)-(float)0.56) < 1.0E-6) )
		{
		ASSERT_EQ(0,0);
		}
		else
		{
		ASSERT_EQ(0,1);
		}
	}

	TEST(should be able to calc the A or B probability: 1-(1-0.2)*(1-0.6))
	{
		Probability probabilityA(0.2);
		Probability probabilityB(0.6);

		if( (fabs((probabilityA | probabilityB)-(float)0.68) < 1.0E-6) )
		{		
		ASSERT_EQ(0,0);
		}
		else
		{
		ASSERT_EQ(0,1);
		}
	}

	TEST(should be able to calc the Probability that A do not happen: 1-0.8=0.2)
	{
                Probability probabilityA(0.8);
		
		if( (fabs((!probabilityA)-(float)0.2) < 1.0E-6) )
		{
		ASSERT_EQ(0,0);
		}
		else
		{
		ASSERT_EQ(0,1);
		}
	}

        
};



